<?php

namespace app\api\controller;

use app\common\controller\Api;



/**
 * 京东联盟接口
 */
class Jd extends Api
{
    //protected $noNeedLogin = ['searchgoods'];
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 关键词查询商品
     *
     */
    public function searchgoods()
    {
        try {
            $page = input('page',1);
            $keyword = input('keyword','');
            $cid1 = input('cid',0);
            $cid2 = input('cid2',0);
            $cid3 = input('cid3',0);
            $owner = input('owner','');
            $jd_model = new \app\common\model\Jd();

            $res = $jd_model->searchGoods($page,$keyword,$cid1,$cid2,$cid3,$owner);
        }  catch (\Exception $e) {
            $this->error($e->getMessage());
        }

        $this->success('请求成功',$res);
    }


    public function ceshi()
    {
        try {
            $jd_model = new \app\common\model\Jd();

            $res = $jd_model->getItemid();
        }  catch (\Exception $e) {
            $this->error($e->getMessage());
        }

        $this->success('请求成功',$res);
    }
}
